﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;
using YArchitech.Revit;

namespace YJKAcquireDataComparison
{
	internal class GeoDuctStruct : GeoObjectStructBase, IGeoObjectStruct
	{
		public GeoDuctStruct(Element element, Autodesk.Revit.DB.View view) : base(element, view)
		{
			base.Attribute = this.GetElementAttribute();
		}

		public GeoDuctStruct()
		{
		}

		public override string GetElementAttribute()
		{
			string elementAttribute = base.GetElementAttribute();
			this.GetExtendAttribute(ref elementAttribute);
			return elementAttribute;
		}

		public void GetExtendAttribute(ref string attr)
		{
			Duct duct = base.UseElement as Duct;
			if (duct == null)
			{
				attr = (attr ?? "");
				return;
			}
			YJKPiping<Duct> hypiping = new YJKPiping<Duct>(duct);
			base.GetStartAndEndPoint(hypiping.GetLocationCurve(), ref attr);
            switch ((int)hypiping.Shape)
			{
			case -1:
				return;
			case 0:
				attr += hypiping.GetDiameter().ToString("f2");
				return;
			case 1:
				attr = attr + hypiping.GetDuctWidthOrHeight(0).ToString("f2") + ";";
				attr = attr + hypiping.GetDuctWidthOrHeight(1).ToString("f2") + ";";
				return;
			case 2:
				return;
			default:
				return;
			}
		}
	}
}
